home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / WIN_VB / VBINT.ZIP;1 / INTDEMO.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-06-04  |  12.7 KB  |  468 lines

  1. VERSION 2.00
  2. Begin Form IntDemo 
  3.    AutoRedraw      =   -1  'True
  4.    Caption         =   "DOS Interrupt Test"
  5.    ClientHeight    =   5295
  6.    ClientLeft      =   990
  7.    ClientTop       =   1470
  8.    ClientWidth     =   7005
  9.    Height          =   5700
  10.    Icon            =   INTDEMO.FRX:0000
  11.    Left            =   930
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   5295
  14.    ScaleWidth      =   7005
  15.    Top             =   1125
  16.    Width           =   7125
  17.    Begin CommandButton bCmd 
  18.       Caption         =   "Dir &Listing"
  19.       Height          =   495
  20.       Index           =   6
  21.       Left            =   5280
  22.       TabIndex        =   5
  23.       Top             =   3060
  24.       Width           =   1545
  25.    End
  26.    Begin Timer Timer1 
  27.       Enabled         =   0   'False
  28.       Interval        =   750
  29.       Left            =   4500
  30.       Top             =   30
  31.    End
  32.    Begin CommandButton bCmd 
  33.       Caption         =   "Dir &Tree"
  34.       Height          =   495
  35.       Index           =   4
  36.       Left            =   5280
  37.       TabIndex        =   4
  38.       Top             =   2490
  39.       Width           =   1545
  40.    End
  41.    Begin ListBox List1 
  42.       FontBold        =   0   'False
  43.       FontItalic      =   0   'False
  44.       FontName        =   "MS Sans Serif"
  45.       FontSize        =   8.25
  46.       FontStrikethru  =   0   'False
  47.       FontUnderline   =   0   'False
  48.       Height          =   4125
  49.       Left            =   300
  50.       TabIndex        =   9
  51.       Top             =   960
  52.       Visible         =   0   'False
  53.       Width           =   4635
  54.    End
  55.    Begin CommandButton bCmd 
  56.       Caption         =   "&FindFirst/Next"
  57.       Height          =   495
  58.       Index           =   3
  59.       Left            =   5280
  60.       TabIndex        =   3
  61.       Top             =   1920
  62.       Width           =   1545
  63.    End
  64.    Begin TextBox Text1 
  65.       Height          =   345
  66.       Left            =   300
  67.       TabIndex        =   8
  68.       Text            =   "Text1"
  69.       Top             =   480
  70.       Visible         =   0   'False
  71.       Width           =   4635
  72.    End
  73.    Begin CommandButton bCmd 
  74.       Caption         =   "D&OS ""Stuff"""
  75.       Height          =   495
  76.       Index           =   2
  77.       Left            =   5280
  78.       TabIndex        =   0
  79.       Top             =   210
  80.       Width           =   1545
  81.    End
  82.    Begin CommandButton bCmd 
  83.       Cancel          =   -1  'True
  84.       Caption         =   "E&xit"
  85.       Height          =   495
  86.       Index           =   5
  87.       Left            =   5280
  88.       TabIndex        =   6
  89.       Top             =   4590
  90.       Width           =   1545
  91.    End
  92.    Begin CommandButton bCmd 
  93.       Caption         =   "Get &Space"
  94.       Height          =   495
  95.       Index           =   1
  96.       Left            =   5280
  97.       TabIndex        =   1
  98.       Top             =   780
  99.       Width           =   1545
  100.    End
  101.    Begin CommandButton bCmd 
  102.       Caption         =   "Get Cur&Dirs"
  103.       Height          =   495
  104.       Index           =   0
  105.       Left            =   5280
  106.       TabIndex        =   2
  107.       Top             =   1350
  108.       Width           =   1545
  109.    End
  110.    Begin Image Image1 
  111.       Height          =   975
  112.       Left            =   5520
  113.       Stretch         =   -1  'True
  114.       Top             =   3600
  115.       Width           =   1065
  116.    End
  117.    Begin Label Label1 
  118.       AutoSize        =   -1  'True
  119.       Caption         =   "Label1"
  120.       Height          =   195
  121.       Left            =   300
  122.       TabIndex        =   7
  123.       Top             =   210
  124.       Visible         =   0   'False
  125.       Width           =   585
  126.    End
  127. '---------------------------------------------------------------------------
  128. ' DOS Interrupt Demo Program, Copyright (c) 1994 Karl E. Peterson
  129. ' Redistributed by permission.
  130. ' Requires: VBInt.DLL, VBRun300.DLL
  131. ' This program may be distributed freely on the condition that it is
  132. ' distributed in full, and unmodified, and that no fee is charged for such
  133. ' distribution with the exception of reasonable media and shipping charges.
  134. ' Any or all portions of the source code may be incorporated into your own
  135. ' programs, and those programs may be distributed without payment of
  136. ' royalties on the condition that such programs differ substantially from
  137. ' this demonstration program.
  138. ' This program is distributed AS IS.  The author acknowledges absolutely
  139. ' no liability for its use or misuse.  The sole purpose of this program is to
  140. ' demonstrate some of the powerful capabilities of VBInt.DLL, written and
  141. ' copyrighted by Rick Esterling.  Calling DOS interrupts from Windows is
  142. ' fairly "non-standard" behavior.  Users of this program acknowledge that
  143. ' they are doing so at their OWN RISK.
  144. ' This demonstration program was created and distributed by:
  145. '   Karl E. Peterson
  146. '   Regional Transportation Council
  147. '   1351 Officers' Row
  148. '   Vancouver, Washington 98661
  149. '   CompuServe: 72302,3707
  150. ' Your comments or questions are invited!
  151. '---------------------------------------------------------------------------
  152. Option Explicit
  153. DefInt A-Z
  154. Const bDirs = 0
  155. Const bSpace = 1
  156. Const bDOS = 2
  157. Const bFind = 3
  158. Const bTree = 4
  159. Const bList = 6
  160. Const bExit = 5
  161. Dim DtaEstablished%
  162. Sub bCmd_Click (Index As Integer)
  163.   Screen.MousePointer = 11
  164.   Cls
  165.   Select Case Index
  166.     Case bDirs, bSpace, bDOS, bExit
  167.       Text1.Visible = False
  168.       Label1.Visible = False
  169.       List1.Visible = False
  170.       Select Case Index
  171.         Case bDirs: ShowCurrentDirs
  172.         Case bSpace: ShowFreeSpace
  173.         Case bDOS: ShowDosStuff
  174.         Case bExit: Unload Me
  175.       End Select
  176.     Case bFind
  177.       List1.Visible = False
  178.       Text1 = "C:\*.*"
  179.       Text1.Visible = True
  180.       Label1 = "FileSpec to Find (press Enter for each match):"
  181.       Label1.Visible = True
  182.       Text1.SetFocus
  183.       Text1.SelStart = 0
  184.       Text1.SelLength = Len(Text1)
  185.       Timer1.Enabled = True
  186.       DtaEstablished = False
  187.     Case bTree, bList
  188.       Text1.Visible = True
  189.       Label1.Visible = True
  190.       List1.Visible = True
  191.       Select Case Index
  192.         Case bTree
  193.           Text1 = "C:"
  194.           Label1 = "Drive to Search (press Enter to begin scan):"
  195.           Refresh
  196.           ShowDirTree (Text1), List1
  197.         Case bList
  198.           Text1 = "C:\"
  199.           Label1 = "Directory to Search (press Enter to begin scan):"
  200.           Refresh
  201.           ShowDirList (Text1), List1
  202.       End Select
  203.       Text1.SetFocus
  204.       Text1.SelStart = 0
  205.       Text1.SelLength = Len(Text1)
  206.   End Select
  207.   Screen.MousePointer = 0
  208. End Sub
  209. Sub Form_Load ()
  210.   Dim Proceed%, m$
  211.   Proceed = IDYES
  212.   If WinIsNT() Then
  213.     m$ = "Running under Windows NT!" + Chr$(13) + Chr$(10)
  214.     m$ = m$ + "Do you wish to continue?"
  215.     Proceed = MsgBox(m$, MB_YESNO + MB_ICONEXCLAMATION + MB_DEFBUTTON2, "Warning")
  216.   End If
  217.   If Proceed = IDYES Then
  218.     DosVersion = DosGetVersion()
  219.     Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
  220.     SetTabs List1
  221.     Show
  222.     bCmd_Click bDOS
  223.   Else
  224.     Unload Me
  225.   End If
  226.   Image1.Picture = Me.Icon
  227. End Sub
  228. Sub SetColor (Bold%)
  229.   If Bold Then
  230.     ForeColor = &H80000008
  231.   Else
  232.     ForeColor = RGB(128, 128, 128)
  233.   End If
  234. End Sub
  235. Sub SetTabs (Lst As ListBox)
  236.   ReDim Tabs(0 To 4) As Integer
  237.   Dim Rtn%
  238.   Tabs(0) = 60
  239.   Tabs(1) = 100
  240.   Tabs(2) = 140
  241.   Tabs(3) = 180
  242.   Tabs(4) = 220
  243.   Rtn = SendMessage(Lst.hWnd, LB_SETTABSTOPS, 5, Tabs(0))
  244. End Sub
  245. Sub ShowCurrentDirs ()
  246.   Dim i%, CurrDir$
  247.   Cls
  248.   For i = 1 To 26
  249.     ForeColor = RGB(128, 0, 0)
  250.     If DrvRemovable(Chr$(i + 64)) Then
  251.       Print "* ";
  252.     ElseIf DrvCDRom(Chr$(i + 64)) Then
  253.       Print "[CD]";
  254.     End If
  255.     If DrvGetDir(Chr$(i + 64), CurrDir$) Then
  256.       ForeColor = RGB(0, 0, 128)
  257.       Print "{" + DrvGetVolume$(Chr$(i + 64)) + "}  ";
  258.       If DrvRemote(Chr$(i + 64)) Then
  259.         ForeColor = RGB(0, 128, 0)
  260.       Else
  261.         ForeColor = RGB(0, 0, 0)
  262.       End If
  263.       Print Chr$(i + 64) + ":" + CurrDir$
  264.     Else
  265.       ForeColor = RGB(128, 128, 128)
  266.       Print Chr$(i + 64) + ": -->" + CurrDir$
  267.     End If
  268.   Next i
  269.   ForeColor = RGB(128, 0, 0)
  270.   Print "* -- Removable Media   ";
  271.   ForeColor = RGB(0, 0, 128)
  272.   Print "{Volume Label}   ";
  273.   ForeColor = RGB(0, 128, 0)
  274.   Print "Remote Drive"
  275.   ForeColor = RGB(0, 0, 0)
  276. End Sub
  277. Sub ShowDirList (DirSpec$, Lst As ListBox)
  278.   Dim Files() As FileDataType
  279.   Dim i%
  280.   Screen.MousePointer = 11
  281.     Lst.Clear
  282.     Lst.Refresh
  283.     If Right$(DirSpec$, 1) <> "\" Then
  284.       DirSpec$ = DirSpec$ + "\*.*"
  285.     Else
  286.       DirSpec$ = DirSpec$ + "*.*"
  287.     End If
  288.     i = FillDirArray(DirSpec$, Files(), attrAllNorm, False, False)
  289.     If i Then
  290.       Lst.AddItem DosErrorMsg$(i)
  291.     Else
  292.       For i = LBound(Files) To UBound(Files)
  293.         Lst.AddItem FmtDirEntry$(Files(i))
  294.       Next i
  295.     End If
  296.   Screen.MousePointer = 0
  297. End Sub
  298. Sub ShowDirTree (Drive$, Lst As ListBox)
  299.   Dim Dirs() As String
  300.   Dim i%
  301.   Screen.MousePointer = 11
  302.     Lst.Clear
  303.     Lst.Refresh
  304.     FillDirTreeArray Dirs(), UCase$(Left$(Drive$, 1)) + ":\", 0
  305.     For i = LBound(Dirs) To UBound(Dirs)
  306.       Lst.AddItem Dirs(i)
  307.     Next i
  308.   Screen.MousePointer = 0
  309. End Sub
  310. Sub ShowDosStuff ()
  311.   Cls
  312.   Print "DOS Version " & Format$(DosVersion / 100, "#0.00")
  313.   If DosAnsiLoaded() Then
  314.     SetColor 1
  315.     Print "Ansi Loaded"
  316.   Else
  317.     SetColor 0
  318.     Print "Ansi NOT Loaded"
  319.   End If
  320.   If DosAppendLoaded() Then
  321.     SetColor 1
  322.     Print "Append Loaded"
  323.   Else
  324.     SetColor 0
  325.     Print "Append NOT Loaded"
  326.   End If
  327.   If DosAssignLoaded() Then
  328.     SetColor 1
  329.     Print "Assign Loaded"
  330.   Else
  331.     SetColor 0
  332.     Print "Assign NOT Loaded"
  333.   End If
  334.   If DosDblSpaceLoaded() Then
  335.     SetColor 1
  336.     Print "DblSpace Loaded"
  337.   Else
  338.     SetColor 0
  339.     Print "DblSpace NOT Loaded"
  340.   End If
  341.   If DosDosKeyLoaded() Then
  342.     SetColor 1
  343.     Print "DosKey Loaded"
  344.   Else
  345.     SetColor 0
  346.     Print "DosKey NOT Loaded"
  347.   End If
  348.   If DosHimemLoaded() Then
  349.     SetColor 1
  350.     Print "HiMem Loaded"
  351.   Else
  352.     SetColor 0
  353.     Print "HiMem NOT Loaded"
  354.   End If
  355.   If DosGraftablLoaded() Then
  356.     SetColor 1
  357.     Print "GrafTabl Loaded"
  358.   Else
  359.     SetColor 0
  360.     Print "GrafTabl NOT Loaded"
  361.   End If
  362.   If DosNetworkLoaded() Then
  363.     SetColor 1
  364.     Print "Network Loaded"
  365.   Else
  366.     SetColor 0
  367.     Print "Network NOT Loaded"
  368.   End If
  369.   If DosNlsfuncLoaded() Then
  370.     SetColor 1
  371.     Print "NlsFunc Loaded"
  372.   Else
  373.     SetColor 0
  374.     Print "NlsFunc NOT Loaded"
  375.   End If
  376.   If DosPrintLoaded() Then
  377.     SetColor 1
  378.     Print "Print Loaded"
  379.   Else
  380.     SetColor 0
  381.     Print "Print NOT Loaded"
  382.   End If
  383.   If DosShareLoaded() Then
  384.     SetColor 1
  385.     Print "Share Loaded"
  386.   Else
  387.     SetColor 0
  388.     Print "Share NOT Loaded"
  389.   End If
  390.   SetColor 1
  391. End Sub
  392. Sub ShowFileFound (Txt As TextBox, First%)
  393.   Static DTA As DTAType
  394.   Dim File As FileDataType
  395.   Dim ErrorCode%, Rtn%
  396.   If First Then
  397.     Rtn = FileFindFirst((Txt), DTA, attrAllFile, ErrorCode)
  398.   Else
  399.     Rtn = FileFindNext(DTA, attrAllFile, ErrorCode)
  400.   End If
  401.   Cls
  402.   CurrentY = Txt.Top + Txt.Height * 1.25
  403.   CurrentX = Txt.Left
  404.   If ErrorCode Then
  405.     Print DosErrorMsg$(ErrorCode)
  406.     DtaEstablished = False
  407.   Else
  408.     FileGetData DTA, File
  409.     Print File.FileName
  410.     CurrentX = Txt.Left
  411.     Print Format$(File.Size, "#,##0"); " bytes"
  412.     CurrentX = Txt.Left
  413.     Print Format$(File.sDate, "long date")
  414.     CurrentX = Txt.Left
  415.     Print Format$(File.sDate, "long time")
  416.     DtaEstablished = True
  417.   End If
  418.   Txt.SelStart = 0
  419.   Txt.SelLength = Len(Txt)
  420. End Sub
  421. Sub ShowFreeSpace ()
  422.   Dim i%, d$, sn$
  423.   Dim disk As DiskFreeSpaceType
  424.   Cls
  425.   For i = 1 To 26
  426.     d$ = Chr$(i + 64) + ":  "
  427.     DrvFreeSpace d$, disk
  428.     If disk.totalBytes Then
  429.       Print d$;
  430.       If DrvCDRom(Chr$(i + 64)) Then
  431.         Print "[CD-ROM]  0 of ";
  432.       Else
  433.         Print Format$(disk.availableBytes, "#,##0");
  434.         Print " of ";
  435.       End If
  436.       Print Format$(disk.totalBytes, "#,##0"); " free  ";
  437.       If DrvGetSerNum(d$, sn$) Then
  438.         Print "S/N:"; sn$
  439.       Else
  440.         Print
  441.       End If
  442.     End If
  443.   Next i
  444. End Sub
  445. Sub Text1_Change ()
  446.   Timer1.Enabled = False
  447.   DtaEstablished = False
  448. End Sub
  449. Sub Text1_KeyPress (KeyAscii As Integer)
  450.   If KeyAscii = 13 Then 'Enter
  451.     KeyAscii = 0
  452.     If InStr(Label1, "FileSpec") Then
  453.       Dim First%
  454.       If Not DtaEstablished Then First = True
  455.       ShowFileFound Text1, First
  456.     ElseIf InStr(Label1, "Drive") Then
  457.       ShowDirTree (Text1), List1
  458.     Else
  459.       ShowDirList (Text1), List1
  460.     End If
  461.   End If
  462. End Sub
  463. Sub Timer1_Timer ()
  464.   If ActiveControl Is Text1 Then
  465.     SendKeys "{Enter}"
  466.   End If
  467. End Sub
  468.